from rich.console import Console
from rich.traceback import install

install()  # 安装 rich 的异常追踪

console = Console()

def divide(a, b):
    return a / b

try:
    result = divide(10, 0)
except Exception:
    console.print_exception()